<html xmlns:concordion="http://www.concordion.org/2007/concordion">
    <body>
		<h1>Complex Number Operations</h1>
		<p>Complex Numbers are numbers of the form z=a+bi, where i is a solution to the equation
		x^2=-1. The common operations on complex numbers are Re, Im, Arg, Mod, and Conj. For
		a more detailed description of complex numbers, see this article on 
		<a href="http://en.wikipedia.org/wiki/Complex_number">Complex numbers</a>.
		</p>
        <p>
        	<table concordion:execute="#result = r(#exp)">
                <tr>
                    <th concordion:set="#exp">R Expression</th>
                    <th concordion:assertEquals="#result">Value</th>
                </tr>
                <tr>
                    <td>Re(eigen(matrix(c(3, 4, -2, -1),2))$vectors[1])</td>
                    <td>0.4082483</td>
                </tr>
                <tr>
                    <td>Im(as.complex(1))</td>
                    <td>0.0</td>
                </tr>
                <tr>
                    <td>Re(as.complex(1))</td>
                    <td>1.0</td>
                </tr>
                <!-- TODO: sqrt currently only takes doubles
                <tr>
                	<td>Im(sqrt(as.complex(-1)))</td>
                	<td>1.0</td>
                </tr> -->
                <tr>
                	<td>Mod(1+1i)</td>
                	<td>1.4142136</td>
                </tr>
                <tr>
                	<td>Im(1+1i + 1+3i)</td>
                	<td>4.0</td>
                </tr>
                <tr>
                	<td>Im((1+1i) - (1+3i))</td>
                	<td>-2.0</td>
                </tr>
                <tr>
                	<td>Im(1+1i * 1+3i)</td>
                	<td>4.0</td>
                </tr>
                <tr>
                	<td>Re((1+1i) * (1+3i))</td>
                	<td>-2.0</td>
                </tr>
                
            </table>

        </p>
    </body>
</html>
